package core;

import helper.Extractor;
import helper.Loader;
import helper.Transformator;

import java.sql.ResultSet;
import java.util.Collection;

import data.ArticleID;
import data.Fact;
import data.ShopID;
import data.TagID;

public class DataWarehouse {

	
	
	/**
	 * Erzeugt neue Kreditvergabe
	 */
	public DataWarehouse() {

//		MainGUI.getInstance().setVisible(true);
	}

	/**
	 * Hauptprogramm
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
//		DataWarehouse dw = new DataWarehouse();
		
		//Exttract
		ResultSet articles = Extractor.getInstance().extractArticle();
		ResultSet shops = Extractor.getInstance().extractShop();
		Collection<String[]> sales = Extractor.getInstance().extractSales();
		
		//Transform
		Collection<ArticleID> artCol = Transformator.getInstance().transformArticle(articles);
		Collection<ShopID> shopCol = Transformator.getInstance().transformShop(shops);
		Collection<TagID> tagCol = Transformator.getInstance().transformTag(sales);
		Collection<Fact> facts = Transformator.getInstance().createFacts(artCol, shopCol, tagCol, sales);
		
		//Load
		Loader.getInstance().loadArticles(artCol);
		Loader.getInstance().loadShops(shopCol);
		Loader.getInstance().loadTage(tagCol);
		Loader.getInstance().loadFacts(facts);
		
//		for(ArticleID a : artCol) {
//			System.out.println(a.getArticleid() +" -- " + a.getName()+ " -- "+a.getPreis()+ " -- "+a.getProductgroup()+ " -- "+a.getProductfamily()+ " -- " + a.getProductgroup());
//		}
		
//		for(ShopID a : shopCol) {
//			System.out.println(a.getShopid() +" -- " + a.getName()+ " -- "+a.getStadt()+ " -- "+a.getRegion()+ " -- "+a.getLand());
//		}
		
//		for(TagID a : tage) {	
//			System.out.println(a.getTagid() +" -- " + a.getDatum()+ " -- "+a.getMonat()+ " -- "+a.getQuartal()+ " -- "+a.getJahr());
//		}
		
//		for(Fact f : facts) {
//			System.out.println(f.getArticle().getArticleid() +" -- " + f.getShop().getShopid()+ " -- "+ f.getTag().getTagid() + " -- "+f.getVerkauft()+ " -- "+f.getUmsatz());
//		}
		
	}
}
